#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int longestPalindrome(string s) {
        int number[126] = { 0 };
        for (auto ch : s) number[ch - 'A']++;
        int ret = 0;
        bool one = false;
        for (int i = 0; i < 126; i++)
        {
            if (number[i] % 2) ret += number[i] / 2 * 2, one = true;
            else ret += number[i];
        }
        if (one) ret++;
        return ret;
    }
};